<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        function Obj() {
            obj = ['赵云', '黄忠', '关羽', '张飞', '马超', '刘备', '曹操']
            let i = Math.floor(Math.random() * obj.length)
            // for (a = 0; a < 3; a++) {
            //     document.write(obj[i])
            //     obj.splice(i, 1)
            // }
            document.write(obj[i])
            obj.splice(i, 1)
            console.log(obj);
        }
        Obj()


    </script>
</body>

</html>